package jd.se.lend;

import jd.se.lend.Book;
import org.apache.ibatis.annotations.*;

/**
 * @author SunJiahao
 * @date 2021-05-22 16:20
 */
@Mapper
public interface LendDao {
    @Select("select b_id, b_name,author,press,lender,status,cover from book where b_id = #{bookId}")
    Book findTeacherById(String bookId);

    @Insert("insert into book(b_id, b_name,author,press,lender,status) values(#{b_id},#{b_name},#{author},#{press},#{lender},2)")
    void insertTeacher(LendDto dto);
    @Select("select lpad(ifnull(max(convert(substring(b_id,7,3),signed)),0)+1,3,'0')  from book where b_id like concat(#{prefix},'%')")
    String findLendNewNum(String prefix);
    @Update("update book set cover = #{avatar} where b_id = #{uid}")
    void updatecover(@Param("uid") String userId, @Param("avatar") String filename);
}